package utils;

public final class HopsCalculations {

	private HopsCalculations() {
		// Utility class
	}

	public static double getHopUtilization(final boolean wholeHops, final long minutes) {
		if (wholeHops) {
			return getWholeHopUtilization(minutes);
		}
		else {
			return getPelletHopUtilization(minutes);
		}
	}

	private static double getPelletHopUtilization(final long minutes) {
		if (minutes >= 75) {
			return 0.34;
		}
		else if (minutes >= 60) {
			return 0.30;
		}
		else if (minutes >= 45) {
			return 0.27;
		}
		else if (minutes >= 30) {
			return 0.24;
		}
		else if (minutes >= 20) {
			return 0.19;
		}
		else if (minutes >= 10) {
			return 0.15;
		}
		else {
			return 0.06;
		}
	}

	private static double getWholeHopUtilization(final long minutes) {
		if (minutes >= 75) {
			return 0.27;
		}
		else if (minutes >= 60) {
			return 0.24;
		}
		else if (minutes >= 45) {
			return 0.22;
		}
		else if (minutes >= 30) {
			return 0.19;
		}
		else if (minutes >= 20) {
			return 0.15;
		}
		else if (minutes >= 10) {
			return 0.12;
		}
		else {
			return 0.05;
		}
	}
}
